home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / t-adainc / i-cpoint.ads < prev    next >
Text File  |  1994-05-19  |  3KB  |  70 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT COMPILER COMPONENTS                         --
  4. --                                                                          --
  5. --                I N T E R F A C E S . C . P O I N T E R S                 --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.2 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
  22. --                                                                          --
  23. ------------------------------------------------------------------------------
  24.  
  25. generic
  26.    type Index is (<>);
  27.    type Element is private;
  28.    type Element_Array is array (Index range <>) of aliased Element;
  29.    Default_Terminator : Element;
  30.  
  31. package Interfaces.C.Pointers is
  32.  
  33.    type Pointer is access all Element;
  34.  
  35.    function Value (Ref        : in Pointer;
  36.                    Terminator : in Element := Default_Terminator)
  37.      return Element_Array;
  38.  
  39.    function Value (Ref    : in Pointer; Length : in Natural)
  40.      return Element_Array;
  41.  
  42.    Pointer_Error : exception;
  43.  
  44.    --  C-style Pointer arithmetic
  45.  
  46.    function "+" (Left : in Pointer;   Right : in Ptrdiff_T) return Pointer;
  47.    function "+" (Left : in Ptrdiff_T; Right : in Pointer)   return Pointer;
  48.    function "-" (Left : in Pointer;   Right : in Ptrdiff_T) return Pointer;
  49.    function "-" (Left : in Pointer;   Right : in Pointer)   return Ptrdiff_T;
  50.  
  51.    procedure Increment (Ref : in out Pointer);
  52.    procedure Decrement (Ref : in out Pointer);
  53.  
  54.    function Virtual_Length (Ref        : in Pointer;
  55.                             Terminator : in Element := Default_Terminator)
  56.      return Natural;
  57.  
  58.    procedure Copy_Terminated_Array
  59.      (Source     : in Pointer;
  60.       Target     : in Pointer;
  61.       Limit      : in Natural := Natural'Last;
  62.       Terminator : in Element := Default_Terminator);
  63.  
  64.    procedure Copy_Array
  65.      (Source  : in Pointer;
  66.       Target  : in Pointer;
  67.       Length  : in Natural);
  68.  
  69. end Interfaces.C.Pointers;
  70.